package com.yanqu.road.server.cmd.match;

import com.yanqu.road.pb.variety.VarietyProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：zfr
 * @date ：2021/2/6 16:28
 */
@Cmd(code = GameProtocol.S_VARIETY_RECEIVE_CROSS_SYNC_VARIETY_LIST, desc = "接收跨服同步杂艺列表请求")
public class ReceiveCrossSyncVarietyListCmd extends AbstractCommand {
    private VarietyProto.SyncVarietyListRespMsg msg;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        msg = VarietyProto.SyncVarietyListRespMsg.parseFrom(packet.getBytes());
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        for (GamePlayer onlinePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
            onlinePlayer.sendPacket(ClientProtocol.U_VARIETY_SYNC_VARIETY_LIST, msg.toBuilder());
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
